package com.ddone.security;

import com.ddone.model.auth.SysUser;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.io.Serializable;
import java.util.Collection;

/**
 * @author ddone
 * @date 2024/3/31-12:15
 * 用户接收数据库的信息
 */
public class AuthUser extends User implements Serializable {
    private static final long serialVersionUID = 10000000123L;

    /**
     * 项目用户实体
     */
    private SysUser sysUser;

    public AuthUser(SysUser sysUser, Collection<? extends GrantedAuthority> authorities) {
        super(sysUser.getUsername(), sysUser.getPassword(), authorities);
        this.sysUser = sysUser;
    }

    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }
}
